package gonz.pages;

import gonz.common.Waiter;
import gonz.pages.swim.SwimIndexPage;
import org.apache.log4j.Logger;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;

public class IndexPage extends AbstractPage {
    public static final Logger log = Logger.getLogger(AbstractPage.class);
    public static final String URL = "http://www.victoriassecret.com";
    public static final String SWIM_XPATH = "//li[@id='swimwear']/a/cufon/canvas";
    public static final String FOOTER_ID = "footer";

    public IndexPage(WebDriver webDriver) {
        super(webDriver);
        webDriver.get(URL);
        Waiter.waitElement(webDriver, By.id(FOOTER_ID));
        log.info(URL + " has been opened.");
    }

    public SwimIndexPage openSwimIndex() {
        webDriver.findElement(By.xpath(SWIM_XPATH)).click();
        return new SwimIndexPage(webDriver);
    }

}
